﻿namespace Microsoft.SharePoint.Client
{
    using Microsoft.SharePoint.Client.Utilities;
    using Microsoft.SharePoint.Client.WebParts;
    using Microsoft.SharePoint.Client.Workflow;
    using System;

    public class ScriptTypeFactory : IScriptTypeFactory
    {
        public IFromJson CreateObjectFromScriptType(string scriptType, ClientRuntimeContext context)
        {
            switch (scriptType)
            {
                case "SP.SecurableObject":
                    return new SecurableObject(context, null);

                case "SP.List":
                    return new List(context, null);

                case "SP.Change":
                    return new Change(context, null);

                case "SP.ChangeItem":
                    return new ChangeItem(context, null);

                case "SP.ChangeSite":
                    return new ChangeSite(context, null);

                case "SP.ChangeWeb":
                    return new ChangeWeb(context, null);

                case "SP.ChangeList":
                    return new ChangeList(context, null);

                case "SP.ChangeFile":
                    return new ChangeFile(context, null);

                case "SP.ChangeFolder":
                    return new ChangeFolder(context, null);

                case "SP.ChangeAlert":
                    return new ChangeAlert(context, null);

                case "SP.ChangeUser":
                    return new ChangeUser(context, null);

                case "SP.ChangeGroup":
                    return new ChangeGroup(context, null);

                case "SP.ChangeContentType":
                    return new ChangeContentType(context, null);

                case "SP.ChangeField":
                    return new ChangeField(context, null);

                case "SP.ChangeView":
                    return new ChangeView(context, null);

                case "SP.ChangeCollection":
                    return new ChangeCollection(context, null);

                case "SP.ContentType":
                    return new ContentType(context, null);

                case "SP.ContentTypeCollection":
                    return new ContentTypeCollection(context, null);

                case "SP.FieldLink":
                    return new FieldLink(context, null);

                case "SP.FieldLinkCollection":
                    return new FieldLinkCollection(context, null);

                case "SP.RequestContext":
                    return new RequestContext(context, null);

                case "SP.WebTemplate":
                    return new WebTemplate(context, null);

                case "SP.Feature":
                    return new Feature(context, null);

                case "SP.FeatureCollection":
                    return new FeatureCollection(context, null);

                case "SP.Field":
                    return new Field(context, null);

                case "SP.FieldText":
                    return new FieldText(context, null);

                case "SP.FieldCalculated":
                    return new FieldCalculated(context, null);

                case "SP.FieldNumber":
                    return new FieldNumber(context, null);

                case "SP.FieldCurrency":
                    return new FieldCurrency(context, null);

                case "SP.FieldMultiLineText":
                    return new FieldMultiLineText(context, null);

                case "SP.FieldDateTime":
                    return new FieldDateTime(context, null);

                case "SP.FieldMultiChoice":
                    return new FieldMultiChoice(context, null);

                case "SP.FieldChoice":
                    return new FieldChoice(context, null);

                case "SP.FieldLookup":
                    return new FieldLookup(context, null);

                case "SP.FieldUser":
                    return new FieldUser(context, null);

                case "SP.FieldUrl":
                    return new FieldUrl(context, null);

                case "SP.FieldComputed":
                    return new FieldComputed(context, null);

                case "SP.FieldRatingScale":
                    return new FieldRatingScale(context, null);

                case "SP.FieldGuid":
                    return new FieldGuid(context, null);

                case "SP.FieldCollection":
                    return new FieldCollection(context, null);

                case "SP.FieldStringValues":
                    return new FieldStringValues(context, null);

                case "SP.File":
                    return new File(context, null);

                case "SP.FileCollection":
                    return new FileCollection(context, null);

                case "SP.FileVersion":
                    return new FileVersion(context, null);

                case "SP.FileVersionCollection":
                    return new FileVersionCollection(context, null);

                case "SP.Folder":
                    return new Folder(context, null);

                case "SP.FolderCollection":
                    return new FolderCollection(context, null);

                case "SP.Form":
                    return new Form(context, null);

                case "SP.FormCollection":
                    return new FormCollection(context, null);

                case "SP.Principal":
                    return new Principal(context, null);

                case "SP.Group":
                    return new Group(context, null);

                case "SP.GroupCollection":
                    return new GroupCollection(context, null);

                case "SP.ListItem":
                    return new ListItem(context, null);

                case "SP.ListItemCollection":
                    return new ListItemCollection(context, null);

                case "SP.ListCollection":
                    return new ListCollection(context, null);

                case "SP.PropertyValues":
                    return new PropertyValues(context, null);

                case "SP.RecycleBinItem":
                    return new RecycleBinItem(context, null);

                case "SP.RecycleBinItemCollection":
                    return new RecycleBinItemCollection(context, null);

                case "SP.RelatedField":
                    return new RelatedField(context, null);

                case "SP.RelatedFieldCollection":
                    return new RelatedFieldCollection(context, null);

                case "SP.RoleAssignment":
                    return new RoleAssignment(context, null);

                case "SP.RoleAssignmentCollection":
                    return new RoleAssignmentCollection(context, null);

                case "SP.RoleDefinitionBindingCollection":
                    return new RoleDefinitionBindingCollection(context, null);

                case "SP.RoleDefinition":
                    return new RoleDefinition(context, null);

                case "SP.RoleDefinitionCollection":
                    return new RoleDefinitionCollection(context, null);

                case "SP.Site":
                    return new Site(context, null);

                case "SP.WebCollection":
                    return new WebCollection(context, null);

                case "SP.UserCustomAction":
                    return new UserCustomAction(context, null);

                case "SP.ListTemplate":
                    return new ListTemplate(context, null);

                case "SP.ListTemplateCollection":
                    return new ListTemplateCollection(context, null);

                case "SP.User":
                    return new User(context, null);

                case "SP.UserCustomActionCollection":
                    return new UserCustomActionCollection(context, null);

                case "SP.UserCollection":
                    return new UserCollection(context, null);

                case "SP.View":
                    return new View(context, null);

                case "SP.ViewFieldCollection":
                    return new ViewFieldCollection(context, null);

                case "SP.ViewCollection":
                    return new ViewCollection(context, null);

                case "SP.Web":
                    return new Web(context, null);

                case "SP.WebParts.WebPartDefinition":
                    return new WebPartDefinition(context, null);

                case "SP.WebParts.WebPartDefinitionCollection":
                    return new WebPartDefinitionCollection(context, null);

                case "SP.WebTemplateCollection":
                    return new WebTemplateCollection(context, null);

                case "SP.Navigation":
                    return new Navigation(context, null);

                case "SP.NavigationNodeCollection":
                    return new NavigationNodeCollection(context, null);

                case "SP.NavigationNode":
                    return new NavigationNode(context, null);

                case "SP.Utilities.Utility":
                    return new Utility(context, null);

                case "SP.Workflow.WorkflowTemplate":
                    return new WorkflowTemplate(context, null);

                case "SP.Workflow.WorkflowAssociation":
                    return new WorkflowAssociation(context, null);

                case "SP.Workflow.WorkflowTemplateCollection":
                    return new WorkflowTemplateCollection(context, null);

                case "SP.Workflow.WorkflowAssociationCollection":
                    return new WorkflowAssociationCollection(context, null);

                case "SP.WebParts.LimitedWebPartManager":
                    return new LimitedWebPartManager(context, null);

                case "SP.WebParts.WebPart":
                    return new WebPart(context, null);

                case "SP.BasePermissions":
                    return new BasePermissions();

                case "SP.ChangeToken":
                    return new ChangeToken();

                case "SP.ChangeQuery":
                    return new ChangeQuery();

                case "SP.ContentTypeCreationInformation":
                    return new ContentTypeCreationInformation();

                case "SP.FieldLinkCreationInformation":
                    return new FieldLinkCreationInformation();

                case "SP.ContentTypeId":
                    return new ContentTypeId();

                case "SP.ListDataValidationExceptionValue":
                    return new ListDataValidationExceptionValue();

                case "SP.ListDataValidationFailure":
                    return new ListDataValidationFailure();

                case "SP.FieldUrlValue":
                    return new FieldUrlValue();

                case "SP.FieldLookupValue":
                    return new FieldLookupValue();

                case "SP.FieldUserValue":
                    return new FieldUserValue();

                case "SP.FieldRatingScaleQuestionAnswer":
                    return new FieldRatingScaleQuestionAnswer();

                case "SP.FileSaveBinaryInformation":
                    return new FileSaveBinaryInformation();

                case "SP.FileCreationInformation":
                    return new FileCreationInformation();

                case "SP.GroupCreationInformation":
                    return new GroupCreationInformation();

                case "SP.ListDataSource":
                    return new ListDataSource();

                case "SP.FieldCalculatedErrorValue":
                    return new FieldCalculatedErrorValue();

                case "SP.ListItemCollectionPosition":
                    return new ListItemCollectionPosition();

                case "SP.ListItemCreationInformation":
                    return new ListItemCreationInformation();

                case "SP.ListCreationInformation":
                    return new ListCreationInformation();

                case "SP.CamlQuery":
                    return new CamlQuery();

                case "SP.RoleDefinitionCreationInformation":
                    return new RoleDefinitionCreationInformation();

                case "SP.UsageInfo":
                    return new UsageInfo();

                case "SP.UserCreationInformation":
                    return new UserCreationInformation();

                case "SP.ViewCreationInformation":
                    return new ViewCreationInformation();

                case "SP.SubwebQuery":
                    return new SubwebQuery();

                case "SP.WebCreationInformation":
                    return new WebCreationInformation();

                case "SP.NavigationNodeCreationInformation":
                    return new NavigationNodeCreationInformation();

                case "SP.Utilities.PrincipalInfo":
                    return new PrincipalInfo();

                case "SP.Workflow.WorkflowAssociationCreationInformation":
                    return new WorkflowAssociationCreationInformation();

                case null:
                    throw new ArgumentNullException("scriptType");
            }
            return null;
        }
    }
}

